include ./Makefile.param

#库文件名
TARGET := librtspserver.so
#库文类型,SO:动态库,A:静态库,BIN:可执行文件
TRAGET_TYPE := SO

SRC := $(wildcard src/*.c)
OBJ := $(SRC:src/%.c=obj/%.o)

ifeq ($(TRAGET_TYPE),SO)
export LINK := $(CC)  -shared -o obj/$(TARGET) $(OBJ) $(SLIBS) $(DLIBS)
DO_STRIP := $(STRIP) obj/$(TARGET)
endif

ifeq ($(TARGET_TYPE),BIN)
export LINK := $(CC) -o obj/$(TARGET) $(OBJ) $(SLIBS) $(DLIBS)
DO_STRIP := $(STRIP) obj/$(TARGET)
endif

ifeq ($(TARGET_TYPE),A)
export LINK := $(AR) $(ARFLAGS) obj/$(TARGET) $(OBJ) $(SLIBS)
endif

ifeq ($(DBG),Y)
DO_STRIP :=
endif

all : obj/$(TARGET)

obj/%.o : src/%.c
	$(CC) $(CFLAGS) -c -o $@ $< $(HISI_INCLUDE) $(DB_INCLUDE)
	@echo
	
obj/$(TARGET) : $(OBJ)
	$(LINK)
	$(DO_STRIP)
	$(CP) obj/$(TARGET) ./lib/

clean :
	$(RM) $(OBJ) obj/$(TARGET)